<?php
//PingBuWang.Com
//Copyright (c) 2017~2099 http://www.pingbuwang.com All rights reserved.
namespace mip;
use think\Controller;
use think\Request;

use mip\Init;
class AdminApiBase extends AuthApiBase {
 
    public function _initialize() {
        parent::_initialize();

        // 忽略的方法
        $passAuthStatus = false;
        $passAuthList = array(
            '0' => 'userAdd',
            '1' => 'loginOut',
            '2' => 'login',
        );
        foreach ($passAuthList as $key => $val) {
            if (strtoupper($passAuthList[$key]) == strtoupper($this->request->action())) {
                $passAuthStatus = true;
            }
        }

        $header = Request::instance()->header();
        if (!$passAuthStatus) {

            $su = session('userInfo');
            if (!$su['isAdmin']) {
                header('Content-Type:application/json; charset=utf-8');
                exit(json_encode(['code'=>1009, 'msg'=>'无权限操作']));
                return;
            }

        }



    }
}
